home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / ebl405.zip / BATDOC2.BAT < prev    next >
DOS Batch File  |  1990-03-01  |  31KB  |  838 lines

  1. bat * Loading HELP and DOCUMENTATION part 2
  2.  
  3. *           Written by F.Canova 10/5/83 through 01/15/90
  4. *   (c) Copyright 1983 to 1990 by Seaware Corp. all rights reserved.
  5. *    This batch file REQUIRES EBL PLUS for proper execution!
  6.  
  7.          **** NOTE! NOTE! NOTE! NOTE! ****
  8.  RAM    |* <-----Change 'RAM' to 'BIOS' if PC isn't 100% IBM Compatible!
  9.  
  10.  if %G = .goto. then %G = | goto -%F
  11.  beep type Error! Begin by using BATDOC first!
  12.  type This file is an overlay to BATDOC.
  13.  exit
  14.  
  15. -opt0     %F = opt0     | skip 3
  16. -line0     %F = line0    | skip 2
  17. -line599  %F = line599 | skip 1
  18. -line1405 %F = line1405
  19.     %G = .goto.
  20.     color 8f |type Loading part 1 ...
  21.     leave
  22.     batdoc
  23.  
  24. -header * Routine prints general purpose header for help text
  25.     stack.purge            |*  remove any pre-typed keystrokes.
  26.     %n = %i $ 1 ( %i # - 2 ) & . & ( %i $ ( %i # - 1 ) 2 ) |* extract section # from page #
  27.     color( white on black )
  28.     cls
  29.     color( white on cyan  )
  30.     window( 1, 1, 79, 3, Combo)
  31.     begtype
  32.  \%H                     Page \%n
  33.  
  34. \07    Press:  PGDN for next page,   PGUP for prev page,  HOME for main menu.
  35. end
  36.     color( white on black)
  37.     colorchar ~ as color(yellow on black)
  38.     window( 1, 5, 79, 25, Combo)
  39.     return
  40.  
  41. -scroll * Routine accepts key for scrolling help text
  42.     %e = 0
  43.     inkey %k
  44.     if %k = KEY("Ctrl-C") then goto -opt0
  45.     if %k = KEY(Esc)  %i = 0      | goto -line0
  46.     if %k = KEY(Home) %i = 0      | goto -line0
  47.     if %k = KEY(Pgup) %i = %i - 1 | cls | %F = line%i | goto -%F
  48.     if %k = KEY(Pgdn) %i = %i + 1 | cls | %F = line%i | goto -%F
  49.     goto -scroll |* ignore any other key.
  50.  
  51.     * ROUTINE TO HAVE USER GIVE A COMMAND A TRY !!
  52.     * %A = string which must match
  53. -tryit
  54.     begtype
  55.  
  56.   Enter your guess!  ;
  57. end
  58. -tryit.loop
  59.     if .%a = . goto -tryit.solved.it |* end of string ?
  60.     %b = %a $ 1 1        |* get 1st letter
  61.     %a = %a $ 2        |* remove it from string
  62. -tryit.retry
  63.     inkey %k          |* get a key.
  64.     if %k = KEY(" ") type %b; | goto -tryit.loop
  65.     if %k = KEY(ESC) type %b%a| goto -tryit.give.up
  66.     if %k = %b type %k;      | goto -tryit.loop
  67.     beep goto -tryit.retry
  68.  
  69. -tryit.solved.it
  70.     begtype
  71.  
  72.  
  73. EXCELLENT !! - that's exactly it!
  74.  
  75. end
  76.     read Press the ─┘ key to continue to next section.....
  77.     return
  78.  
  79. -tryit.give.up
  80.     begtype
  81.  
  82. That's the answer you needed! (You can "peek" at part of
  83. the answer next time by pressing the space bar if you'd like.)
  84.  
  85. end
  86.     read Press the ─┘ key to continue to next section.....
  87.     return
  88.  
  89. -opt6
  90. -line503 %i = 600
  91. -line600 %H = "How to print" | call -header| begtype
  92.  
  93.   The simplest thing to for Extended Batch Language to do is to print text
  94. on the display.  This is done by either of two commands, TYPE and BEGTYPE.
  95.  
  96.   The TYPE command can be used for something as simple as saying hello!
  97. For example:
  98.  
  99.     TYPE "HELLO THERE"
  100.  
  101.   This is all that is needed.  This command can be typed directly from DOS
  102. (this is called immediate mode) or be entered into a file such as
  103. "TRIAL.BAT" (this is called direct execution mode).  To execute it as a BAT
  104. program with the file, just type the file's name "TRIAL" from DOS and you
  105. will see the results of the program "HELLO THERE" coming from BAT.
  106. end
  107.     goto -scroll
  108. -line601 call -header | begtype
  109.  
  110.   You can also put DOS variables into this command to display their
  111. contents.  For example, if the "TRIAL.BAT" file contained the line:
  112.  
  113.     TYPE "HELLO THERE" %1 %2
  114.  
  115.   Then when we start the BAT program from DOS, we might enter:
  116.  
  117.     TRIAL COMPUTER USER
  118.  
  119.   DOS will automatically store the words after the program name into its
  120. variables.  Therefore, in the TYPE command, we will see contents of these
  121. variables on the screen.  The resulting message would be:
  122.  
  123.     HELLO THERE COMPUTER USER
  124. end
  125.     goto -scroll
  126. -line602 call -header | begtype
  127.  
  128.   There is a second method of putting text onto the display.  This is with
  129. the BEGTYPE command.  Although it will not display the contents of
  130. variables, it is very useful for displaying large blocks of text, such as
  131. menus.    For example, if the "TRIAL.BAT" file contains:
  132.  
  133.     BAT BEGTYPE
  134.     This is a large block of text. It is useful for menus. Note
  135.     that Upper/Lower case characters are displayed intact here.
  136.     The block is always ended with "END" in the first column
  137.     after the text finishes.
  138.     END
  139.  
  140.   When executed, the "TRIAL.BAT" program will display:
  141.  
  142.     This is a large block of text. It is useful for menus. Note
  143.     that Upper/Lower case characters are displayed intact here.
  144.     The block is always ended with "END" in the first column
  145.     after the text finishes.
  146. end
  147.     goto -scroll
  148. -line699 %i = 603
  149. -line603 call -header | begtype
  150.  
  151.   There is an additional advantage to using BEGTYPE command.  This command
  152. can also highlight text to the user.  This is done by using the form:
  153. [\\hex] within the text block.
  154.  
  155.   For example if the text block contained \\0F within the text, the result
  156. would be ~ High Intensity Text !  ~.
  157.  
  158.   By choosing different values, the screen attributes can be controlled to
  159. create inverted video, blinking, underlined, and very colorful text.
  160.  
  161.   You can also display the contents of variables by using [\\%Var.name] in
  162. the text block. For instance, if the variable %0 is to be printed, use \\%0
  163. within the text after the BEGTYPE command.
  164.  
  165.   An additional command CLS can be used to clear the display before
  166. printing data.    For instance, the combination "BAT CLS BEGTYPE" is quite
  167. useful for printing menus and text such as this screen.
  168. end
  169.     goto -scroll
  170. -line604
  171.     begtype
  172.  
  173.     ~NOW IT'S YOUR TURN !!!~
  174.  
  175.  
  176. If the ~%4~ variable contains the word ~DAY~, what is the command to display
  177. the words "~FUN DAY~" on the display?
  178.  
  179. end
  180.      %A = "TYPE FUN %4" | Call -tryit
  181. -opt7
  182. -line605  %i = 700
  183. -line700 %H = "Reading things from user" | call -header | begtype
  184.   In order to get input from the user, there are two available commands,
  185. READ and INKEY.
  186.  
  187.   When the command word READ is seen in the batch file, an input line is
  188. accepted from the user.  All function keys are assigned to the normal DOS
  189. edit functions.  When ENTER is pressed, the input line is assigned to DOS
  190. variables.
  191.  
  192.   Each word will be assigned in order to the variables indicated after the
  193. READ command.  When there are no more variables after the READ command to
  194. assign, the remainder of the response is thrown away.  If there are more
  195. variables to be assigned after the READ command than there are words from
  196. the user, these variables will be cleared out to a empty state.  For
  197. example:
  198.  
  199.     READ Please enter your name ==> %1 %2
  200.  
  201.   This would prompt the user and wait for him to enter two words.  These
  202. words will be saved in the %1 and %2 variables.
  203. end
  204.      goto -scroll
  205. -line701 call -header | begtype
  206.  
  207.   Note that there does not have to be any variables indicated after the
  208. command READ.  In this case, EBL would wait for the enter key, throw away
  209. any response, then continue to process the next batch file command.
  210.  
  211. end
  212.     goto -scroll
  213. -line702 call -header | begtype
  214.  
  215.   In the event that you wish to get a single keystroke from the user, the
  216. INKEY command should be used.
  217.  
  218.   This command will wait for the user to enter a single key on the keyboard
  219. and return its value in the optional variable.    This key can be not only
  220. letters, but all function keys, control keys, etc.  For example:
  221.  
  222.     INKEY Press any key to continue... %0
  223.  
  224.   When the user presses a single key, that key is saved into the variable %0.
  225.  
  226.   If the key that is pressed is in the range of "!" to "z" (decimal 33 to
  227. 122) then the key saved to the optional variable. If you wish this key to be
  228. echoed to the display, you must specifically use the TYPE command.
  229.  
  230. end
  231.      goto -scroll
  232. -line799 %i = 703
  233. -line703 call -header | begtype
  234.  
  235.   If the key is not in the above range, then the key will be converted to
  236. the form "KEYxxx" where xxx is the hex value of the key.  Extended key
  237. codes will be in the range KEY100 to KEY1FF and nonextended key codes will
  238. be in the range KEY000 to KEY0FF.  Refer to Appendix G of the Basic manual
  239. for a complete description of the various assignments of key codes.
  240.  
  241.   The character does not have to be assigned to a variable.  If the
  242. variable name is not present following t